package org.codeCard.dialog;

import come.tool.JDialog.TiShiChuLi;
import org.cbg.bean.SearchGoodsBean;
import org.codeCard.bean.TbSaleCardOrder;
import org.codeCard.frame.CodeCardJFrame;
import org.codeCard.panel.CodeCardSaleJPanel;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.GsonUtil;

public class ConfirmSellerCardJDialog implements TiShiChuLi {
    @Override
    public void tipBox(boolean tishi, Object object) {
        if (tishi) {

            TbSaleCardOrder saleCardOrder = (TbSaleCardOrder) object;


            String sendmes = Agreement.getAgreement().saleCardShelfAgreement(
                    GsonUtil.getGsonUtil().getgson().toJson(saleCardOrder));
            SendMessageUntil.toServer(sendmes);

            new Thread(()->{
                try {

                    CodeCardSaleJPanel buyXianYuJpanel = CodeCardJFrame.getBjczMainJpanel().getBjczCardJpanel().getBjcz2Jpanel();
                    buyXianYuJpanel.setMeiDian("");
                    buyXianYuJpanel.getJiShouDianShu().setText("");
                    buyXianYuJpanel.getZongJia().setText("");
                    buyXianYuJpanel.setShouXuFei("");
                    buyXianYuJpanel.setCustomerOrder(null);

                    Thread.sleep(1000L);
                    SearchGoodsBean searchGoodsBean1 = new SearchGoodsBean();
                    searchGoodsBean1.setSaletype(2);
                    searchGoodsBean1.setPageNum(1);
                    String sendmes1 = Agreement.getAgreement().saleCardMySearchAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean1));
                    SendMessageUntil.toServer(sendmes1);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            }).start();
        }
    }
}
